#ifndef EXCEPTION_H_
#define EXCEPTION_H_

#include <string>
#include <iostream>

/*!
	This class is used to throw exceptions. It can take a description, a source filename and a line to be displayed.
*/
class Exception
{
	protected:
	std::string type__;		/**< Type of exception. Can only be changed by sub-typing this class. */
	std::string description__;	/**< Description of exception. */
	std::string file__;		/**< File from where occured the exception; the special compilation directive __FILE__ may be used. */
	int line__;			/**< Line from where occured the exception; the special compilation directive __LINE__ may be used. */

	public:
	/*! Constructor. Just initialize everything. Initializes type__ to "General Exception". */
	Exception(const std::string& d="", const std::string& f = "", int l = 0);
	/*! Destructor. Does nothing. */
	virtual ~Exception();

	/*! returns a reference to the description. */
	std::string& description();
	/*! returns a reference to the file name. */
	std::string& file();
	/*! returns a reference to the line number. */
	int& line();

	/*! returns a const reference to the description. */
	const std::string& description() const;
	/*! returns a const reference to the file name. */
	const std::string& file() const;
	/*! returns a const reference to the line number. */
	const int& line() const;
	/*! returns a const reference to the type. */
	const std::string& type() const;
};

/*! Beautiffully prints the excpetion. */
std::ostream& operator<< (std::ostream& os, const Exception& e);

#endif

